home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CPPTASK.ARJ / README.TXT < prev    next >
Text File  |  1991-08-21  |  5KB  |  104 lines

  1. This package is a port of CTask from C to C++, hence the name CPPTask.  Since
  2. this is a spare time (and until now for personal use only) activity, I have
  3. not documented the changes that I have made.
  4.  
  5. For the most part, all of the changes that I have made were for converting
  6. CTask to a class-based system.  The original package was largely "object-
  7. oriented" anyway.  The interesting areas surfaced in the C++ to assembly
  8. language interface (different linkage, etc.), and in the area of dynamic
  9. allocation of tasks, pipes, etc.  The first problem was solved by creating
  10. C-linkage functions that invoked member functions.  These functions are
  11. used by the assembly language routines.  For example, in several of the
  12. assmbly language routines the function "inc_counter(counterptr)" was used.
  13. Since that function became "counter::inc_counter(void)", I created a
  14. function called "asm_inc_counter(counterptr)" with C-linkage.  That function
  15. simply invokes the member function:
  16.  
  17.          void asm_inc_counter(counterptr ptr)
  18.          {
  19.             ptr->inc_counter();
  20.          }
  21.  
  22. I'm not sure if this is the best way, but it works.  Also, several of the
  23. assembly language routines created objects, and since constructors cannot
  24. be invoked directly, I moved the creation of the objects to the C++ code
  25. and used the objects as described earlier.
  26.  
  27. The biggest problem was the dynamic creation of objects.  The C version of
  28. the create_??? routines checked for a NULL pointer and allocated memory if
  29. necessary.  I redefined the new operator to perform the same processing.
  30. I am not sure if I have done everything that is necessary in the new "new".
  31. The file TSKALLOC.CPP contains the code.  Also, I created "task::operator new"
  32. and "task::operator delete" to perform some processing previously done
  33. elsewhere.  One final change in this area concerns the deletion of tasks
  34. that are enqueued on a timer queue.  The original version merely set a
  35. flag in the tlink structure that indicated that this entry could be deleted.
  36. Unfortunately, the statement:
  37.  
  38.         delete mytask;
  39.  
  40. could be disasterous if a timer queue was pointing to it.  My solution was
  41. to change the task definition to include a pointer to a tlink structure
  42. instead of having the structure nested.  This would allow the parent task
  43. to be deleted and the tlink structure to be marked for deletion when it was
  44. removed from the timer queue.
  45.  
  46. I also removed the Named object processing (I was to lazy to convert it),
  47. and the support for other compilers.  Since I was converting it to Turbo C++
  48. and I have no access to any other, I would be unable to test any conditional
  49. compilations anyway.  Finally, I have not yet ported the parallel port
  50. interface or the AT-BIOS interface.
  51.  
  52. Other than added some comments and rearranging some of the files, that is
  53. all I changed (funny it doesn't sound like much now.)  I also changed the
  54. name of a couple of the structures, (so they made more sense to me) I hope
  55. this doesn't cause to much confusion.
  56.  
  57. I am still not convinced that I have covered everything in the area of
  58. dynamic allocation and deallocation.  I have tried some very minor variations
  59. on the original test programs, and it seems to work , but...
  60.  
  61. Good Luck!
  62.  
  63. Rich
  64.  
  65.  
  66.  
  67. P.S. Here is a list of the files included in the archive:
  68.  
  69.  
  70.      tskmain.cpp   - some of the main routines, and the declaration of
  71.                      the static objects
  72.      tsksub.cpp    - some support routines
  73.      tsktask.cpp   - task object routines
  74.      tsktimer.cpp  - timer object routines
  75.      tskalloc.cpp  - memory allocation routines
  76.      tskrsc.cpp    - resource object routines
  77.      tskcnt.cpp    - counter object routines
  78.      tskflg.cpp    - flag object routines
  79.      tskmsg.cpp    - mailbox object routines
  80.      tskpip.cpp    - pipe object routines
  81.      tskwpip.cpp   - word pipe class routines
  82.      tskbuf.cpp    - buffer class routines
  83.      tsksio.cpp    - comm port class routines
  84.      conout.cpp    - sample use of console output
  85.      test.cpp      - simple test program
  86.      tsio.cpp      - simple serial I/O test program
  87.  
  88.      conout.hpp    - header file for sample console output
  89.      sio.hpp       - header file for comm port class
  90.      task.hpp      - header file for all other classes
  91.      tskconf.hpp   - header file containing configuration definitions
  92.      tsklocal.hpp  - header file used internally by CPPTask
  93.  
  94.      tskasm.asm    - scheduler
  95.      tskbios.asm   - BIOS support (NOT PORTED!!!)
  96.      tskdos.asm    - DOS support
  97.      tskkbd.asm    - keyboard support
  98.      tsktim.asm    - timer interrupt support
  99.  
  100.      tsk.mac       - include file for assembly language
  101.  
  102.      test.prj      - sample project file
  103.      tsio.prj      - sample project file
  104.